Skip to content

Commit

Permalink
v1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pkriens committed Aug 25, 2020
1 parent 9cf066c commit afbcdbe
Show file tree
Hide file tree
Showing 16 changed files with 105 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ target/
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
/.metadata/
biz.aQute.protoc.test/errors
13 changes: 13 additions & 0 deletions biz.aQute.protoc.test/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="aQute.bnd.classpath.container"/>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="src" output="target/classes" path="src-gen">
<attributes>
<attribute name="ignore_optional_problems" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
1 change: 1 addition & 0 deletions biz.aQute.protoc.test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/src-gen/
23 changes: 23 additions & 0 deletions biz.aQute.protoc.test/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>biz.aQute.protoc.test</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>bndtools.core.bndbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>bndtools.core.bndnature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/bnd.bnd=UTF-8
11 changes: 11 additions & 0 deletions biz.aQute.protoc.test/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
8 changes: 8 additions & 0 deletions biz.aQute.protoc.test/bnd.bnd
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
src = ${^src},src-gen

-generate \
proto; \
output = src-gen; \
generate = "biz.aQute.protoc.Protoc -I=proto --java_out=src-gen proto/adddressbook.proto 2>errors"

-buildpath: com.google.protobuf;version='4.0.0'
29 changes: 29 additions & 0 deletions biz.aQute.protoc.test/proto/adddressbook.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
syntax = "proto2";

package tutorial;

option java_package = "com.example.tutorial";
option java_outer_classname = "AddressBookProtos";

message Person {
required string name = 1;
required int32 id = 2;
optional string email = 3;

enum PhoneType {
MOBILE = 0;
HOME = 1;
WORK = 2;
}

message PhoneNumber {
required string number = 1;
optional PhoneType type = 2 [default = HOME];
}

repeated PhoneNumber phones = 4;
}

message AddressBook {
repeated Person people = 1;
}
Empty file.
Empty file.
2 changes: 1 addition & 1 deletion biz.aQute.protoc/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
<classpathentry kind="con" path="aQute.bnd.classpath.container"/>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="output" path="bin"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
7 changes: 4 additions & 3 deletions biz.aQute.protoc/bnd.bnd
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@

-includepackage biz.aQute.protoc
-includepackage biz.aQute.protoc.*

-includeresource: \
exe/protoc-osx-x86_64=${repo;com.google.protobuf:protoc:exe:osx-x86_64}, \
exe/protoc-windows-x86_64=${repo;com.google.protobuf:protoc:exe:windows-x86_64}, \
exe/protoc-linux-x86_64=${repo;com.google.protobuf:protoc:exe:linux-x86_64}
exe/protoc-linux-x86_64=${repo;com.google.protobuf:protoc:exe:linux-x86_64},\
{src/main/resources}


-buildpath: \
Expand All @@ -15,4 +16,4 @@
Main-Class biz.aQute.protoc.Protoc
JPM-Command protoc

-conditionalpackage: aQute*, org.slf*
-conditionalpackage: aQute*, org.slf*
18 changes: 9 additions & 9 deletions biz.aQute.protoc/src/main/java/biz/aQute/protoc/Protoc.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import java.nio.file.Files;
import java.nio.file.attribute.PosixFilePermission;
import java.util.EnumSet;
import java.util.jar.Manifest;

import aQute.lib.io.IO;
import aQute.lib.strings.Strings;
import aQute.libg.command.Command;

public class Protoc {
Expand All @@ -30,12 +30,12 @@ else if (osName.startsWith("mac") || osName.startsWith("darwin") || osName.start

URL resource = Protoc.class.getResource(name);
if (resource == null) {
throw new IllegalArgumentException("Corrupt jar, not found resource " + name);
throw new IllegalArgumentException("Corrupt jar, not found " + name);
}
IO.copy(resource, f);
f.setLastModified(modified);
Files.setPosixFilePermissions(f.toPath(),
EnumSet.of(PosixFilePermission.OWNER_EXECUTE, PosixFilePermission.OWNER_READ));
EnumSet.of(PosixFilePermission.OWNER_EXECUTE, PosixFilePermission.OWNER_READ, PosixFilePermission.OWNER_WRITE));
}
Command cmd = new Command();
cmd.add(f.getAbsolutePath());
Expand All @@ -46,11 +46,11 @@ else if (osName.startsWith("mac") || osName.startsWith("darwin") || osName.start
}

private static long getModified() throws NumberFormatException, IOException {
return Long.parseLong( getManifest().getMainAttributes().getValue("Bnd-LastModified"));
}

private static Manifest getManifest() throws IOException {
URL url = Protoc.class.getResource("/META-INF/MANIFEST.MF");
return new Manifest(url.openStream());
String timestamp = IO.collect(Protoc.class.getResource("timestamp.txt"));
if ( timestamp == null) {
return 0L;
}

return Long.parseLong(Strings.trim(timestamp));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
${now;long}
2 changes: 1 addition & 1 deletion cnf/build.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ test-cases: ${classes;NAMED;*Test}
copyright.year = ${tstamp;yyyy}

baseline.version: 1.0.0
base.version: 1.1.0
base.version: 1.2.0

# To release, remove the -SNAPSHOT

Expand Down
2 changes: 1 addition & 1 deletion cnf/central.mvn
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ com.google.protobuf:protoc:exe:linux-x86_64:4.0.0-rc-2
com.google.protobuf:protoc:exe:osx-x86_64:4.0.0-rc-2
com.google.protobuf:protoc:exe:windows-x86_32:4.0.0-rc-2
com.google.protobuf:protoc:exe:windows-x86_64:4.0.0-rc-2

com.google.protobuf:protobuf-java:4.0.0-rc-2

# OSGi R7

Expand Down

0 comments on commit afbcdbe

Please sign in to comment.