Skip to content

Instantly share code, notes, and snippets.

@mateor
Created May 5, 2016 21:58
Show Gist options
  • Save mateor/9b6d34b4a8fe2011387e85a934958785 to your computer and use it in GitHub Desktop.
Save mateor/9b6d34b4a8fe2011387e85a934958785 to your computer and use it in GitHub Desktop.
Add buildgen to an arbitrary pants project
diff --git a/.gitignore b/.gitignore
index a61ace7..0ced64a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,6 +18,7 @@
.#*
.DS_Store
.artifact_cache
+.buildgen_timestamp
.cache
.classpath
.coverage
diff --git a/3rdparty/python/requirements.txt b/3rdparty/python/requirements.txt
index 8ba4cfd..f2535b9 100644
--- a/3rdparty/python/requirements.txt
+++ b/3rdparty/python/requirements.txt
@@ -1,4 +1,10 @@
+fsqio.pants.contrib.buildgen.core==1.0.0
+fsqio.pants.contrib.buildgen.jvm==1.0.0
+fsqio.pants.contrib.buildgen.python==1.0.0
psycopg2==2.5.3
pymongo==2.8
requests==2.3.0
requests-futures==0.9.4
+twitter.common.collections==0.3.3
+twitter.common.dirutil==0.3.3
+
diff --git a/BUILD.opensource b/BUILD.opensource
new file mode 100644
index 0000000..791ced3
--- /dev/null
+++ b/BUILD.opensource
@@ -0,0 +1,22 @@
+# Copyright 2016 Foursquare Labs Inc. All Rights Reserved.
+
+
+def sjar(org, name, rev, url=None):
+ scala_jar_version = '2.10'
+ return jar(org = org, name = '%s_%s' % (name, scala_jar_version), rev = rev, url = url)
+
+
+jar_library(
+name = 'buildgen-emit-used-symbols',
+ jars = [
+ sjar(org = 'io.fsq', name = 'buildgen-emit-used-symbols', rev = '1.1.0'),
+ ]
+)
+
+
+jar_library(
+ name = 'buildgen-emit-exported-symbols',
+ jars = [
+ sjar(org = 'io.fsq', name = 'buildgen-emit-exported-symbols', rev = '1.1.0'),
+ ]
+)
diff --git a/pants.ini b/pants.ini
index fd658eb..10779be 100644
--- a/pants.ini
+++ b/pants.ini
@@ -14,6 +14,9 @@ pythonpath: [
]
backend_packages: [
+ "pants.contrib.buildgen.core",
+ "pants.contrib.buildgen.jvm",
+ "pants.contrib.buildgen.python",
'fsqio.pants',
]
@@ -231,6 +235,67 @@ repos = {
version: 2.10
+[buildgen]
+source_dirs: [
+ 'src',
+ '3rdparty',
+ ]
+
+test_dirs: [
+ 'test',
+ ]
+
+target_whitelist: [
+ 'java_tests',
+ 'junit_tests',
+ 'python_library',
+ 'python_tests',
+ 'scala_library',
+ 'scalac_plugin',
+ ]
+
+managed_dependency_aliases: [
+ 'jar_library',
+ 'python_library',
+ 'python_requirement_library',
+ 'scala_library',
+ ]
+
+required_products: [
+ 'concrete_target_to_derivatives',
+ 'java',
+ 'java_source_to_exported_symbols',
+ 'python',
+ 'python_source_to_exported_symbols',
+ 'scala',
+ 'scala_source_to_exported_symbols',
+ 'scala_source_to_used_symbols',
+ 'source_to_addresses_mapper',
+ ]
+
+
+
+[buildgen.python]
+first_party_packages = [
+ 'fsqio',
+ ]
+
+ignored_prefixes: [
+ 'pants',
+ 'pex',
+ ]
+
+
[tag]
# NOTE: This is overrided internally - for use with Fsq.io only.
by_prefix: {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment