chrisrueger commented on code in PR #79:
URL: https://github.com/apache/freemarker/pull/79#discussion_r1431899536


##########
osgi.bnd:
##########
@@ -21,16 +21,13 @@
 # imports by examining the class files, and generates the OSGi meta-info
 # based on that and this file.
 
--classpath: build/classes
 -failok: false
 

Review Comment:
   @kelemen 
   
   I recently had to do with reproducible builds. 
   In this context it might be worth considering adding the following bnd 
properties:
   
   ```
   -reproducible: true
   -noextraheaders: true
   ```
   
   See [here](https://bnd.bndtools.org/instructions/reproducible.html) and 
[here](https://bnd.bndtools.org/instructions/noextraheaders.html) 



##########
build.gradle.kts:
##########
@@ -0,0 +1,572 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.nio.charset.StandardCharsets
+import java.nio.file.Files
+import java.util.stream.Collectors
+
+plugins {
+    `freemarker-root`
+    `maven-publish`
+    signing
+    id("biz.aQute.bnd.builder") version "6.1.0"
+    id("eclipse")
+}
+
+group = "org.freemarker"
+
+val fmExt = freemarkerRoot
+
+tasks.withType<JavaCompile>().configureEach {
+    options.encoding = "UTF-8"
+}
+
+freemarkerRoot {
+    configureTestUtils("16")
+
+    configureSourceSet(SourceSet.MAIN_SOURCE_SET_NAME, "8") { enableTests() }
+    configureSourceSet("jsp20", "8")
+    configureSourceSet("jsp21", "8") { enableTests() }
+    configureSourceSet("jython20", "8")
+    configureSourceSet("jython22", "8")
+    configureSourceSet("jython25", "8") { enableTests() }
+    configureSourceSet("core16", "16")
+}
+
+val compileJavacc = 
tasks.register<freemarker.build.CompileJavaccTask>("compileJavacc") {
+    sourceDirectory.set(file("freemarker-core/src/main/javacc"))
+    destinationDirectory.set(project.layout.buildDirectory.map { 
it.dir("generated").dir("javacc") })
+    javaccVersion.set("7.0.12")
+
+    fileNameOverrides.addAll(
+        "ParseException.java",
+        "TokenMgrError.java"
+    )
+
+    val basePath = "freemarker/core"
+
+    replacePattern(
+        "${basePath}/FMParser.java",
+        "enum",
+        "ENUM"
+    )
+    replacePattern(
+        "${basePath}/FMParserConstants.java",
+        "public interface FMParserConstants",
+        "interface FMParserConstants"
+    )
+    replacePattern(
+        "${basePath}/Token.java",
+        "public class Token",
+        "class Token"
+    )
+    // FIXME: This does nothing at the moment.
+    replacePattern(
+        "${basePath}/SimpleCharStream.java",
+        "public final class SimpleCharStream",
+        "final class SimpleCharStream"
+    )
+}
+sourceSets.main.get().java.srcDir(compileJavacc)
+
+tasks.sourcesJar.configure {
+    from(compileJavacc.flatMap { it.sourceDirectory })
+
+    from(files("LICENSE", "NOTICE")) {
+        into("META-INF")
+    }
+}
+
+tasks.javadocJar.configure {
+    from(files("src/dist/javadoc"))
+    from(files("NOTICE")) {
+        into("META-INF")
+    }
+}
+

Review Comment:
   @kelemen 
   also about reproducible builds (see my other comment)
   
   Something like this might be worth considering for a reproducible build.
   
   ```
   tasks.withType<AbstractArchiveTask>().configureEach {
     isPreserveFileTimestamps = false
     isReproducibleFileOrder = true
     filePermissions {
       unix("rw-r--r--")
     }
     dirPermissions {
       unix("rwxr-xr-x")
     }
   }
   ```
   
   Background info 
[here](https://github.com/jvm-repo-rebuild/reproducible-central)
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to