From 299c942d2db6a6251aea3a0e7bf7490b006ef3ec Mon Sep 17 00:00:00 2001 From: Anadroid Date: Thu, 28 Jan 2021 11:46:55 +0100 Subject: [PATCH 1/5] Adding arguments to doclet script --- doclet/README.md | 4 +- .../ReferenceGenerator/processingrefBuild.sh | 69 ++++++++++++++----- 2 files changed, 52 insertions(+), 21 deletions(-) diff --git a/doclet/README.md b/doclet/README.md index d2ac7a461..64237704c 100644 --- a/doclet/README.md +++ b/doclet/README.md @@ -22,8 +22,8 @@ You also need to have [Apache Ant](https://ant.apache.org/manual/install.html) i Now run the Doclet: 1. First move into the `processing4/doclet/ReferenceGenerator` folder -1. Run `ant compile` -1. Run `./processingrefBuild.sh` +2. Run `ant compile` +3. Run `./processingrefBuild.sh` **note:if you want to run the script just for the main processing references(including libraries serial, net and io) you should run `./processingrefBuild.sh processing` and if you want to run the script for sound or video library you should run `./processingrefBuild.sh sound` or `./processingrefBuild.sh video`** If you are only updating the processing reference and not the sound or video libraries, you can comment out the part related to those libraries in the `processingrefBuild.sh` file. Please remember to not commit these changes to the repo. diff --git a/doclet/ReferenceGenerator/processingrefBuild.sh b/doclet/ReferenceGenerator/processingrefBuild.sh index 81a59a654..946f6afe9 100755 --- a/doclet/ReferenceGenerator/processingrefBuild.sh +++ b/doclet/ReferenceGenerator/processingrefBuild.sh @@ -11,16 +11,55 @@ REFERENCES_OUT_PATH=../../../processing-website/content/references/translations/ echo "[REFERENCE GENERATOR] Source Path :: $PROCESSING_SRC_PATH" echo "[REFERENCE GENERATOR] Library Path :: $PROCESSING_LIB_PATH" - -echo "[REFERENCE GENERATOR] Removing previous version of the ref..." -rm -rf $REFERENCES_OUT_PATH -mkdir $REFERENCES_OUT_PATH -mkdir $REFERENCES_OUT_PATH/processing -mkdir $REFERENCES_OUT_PATH/io -mkdir $REFERENCES_OUT_PATH/net -mkdir $REFERENCES_OUT_PATH/serial -mkdir $REFERENCES_OUT_PATH/sound -mkdir $REFERENCES_OUT_PATH/video +#you can pass one argument "sound" or "video" to generate those libraries separately +#if there is no argument it will generate everything +if [ $# -eq 0 ] + then + echo "No arguments supplied, generating everything" + echo "[REFERENCE GENERATOR] Removing previous version of the ref..." + rm -rf $REFERENCES_OUT_PATH + mkdir $REFERENCES_OUT_PATH + mkdir $REFERENCES_OUT_PATH/processing + mkdir $REFERENCES_OUT_PATH/io + mkdir $REFERENCES_OUT_PATH/net + mkdir $REFERENCES_OUT_PATH/serial + mkdir $REFERENCES_OUT_PATH/sound + mkdir $REFERENCES_OUT_PATH/video + FOLDERS="$PROCESSING_SRC_PATH/processing/core/*.java \ + $PROCESSING_SRC_PATH/processing/data/*.java \ + $PROCESSING_SRC_PATH/processing/event/*.java \ + $PROCESSING_SRC_PATH/processing/opengl/*.java \ + $PROCESSING_LIB_PATH/io/src/processing/io/*.java \ + $PROCESSING_LIB_PATH/net/src/processing/net/*.java \ + $PROCESSING_LIB_PATH/serial/src/processing/serial/*.java \ + $PROCESSING_LIB_PATH/../../../processing-video/src/processing/video/*.java \ + $PROCESSING_LIB_PATH/../../../processing-sound/src/processing/sound/*.java" + elif [ $1 = "processing" ] + then + echo "Generating processing references" + echo "[REFERENCE GENERATOR] Removing previous version of the ref..." + rm -rf $REFERENCES_OUT_PATH/processing + rm -rf $REFERENCES_OUT_PATH/io + rm -rf $REFERENCES_OUT_PATH/net + rm -rf $REFERENCES_OUT_PATH/serial + mkdir $REFERENCES_OUT_PATH/processing + mkdir $REFERENCES_OUT_PATH/io + mkdir $REFERENCES_OUT_PATH/net + mkdir $REFERENCES_OUT_PATH/serial + FOLDERS="$PROCESSING_SRC_PATH/processing/core/*.java \ + $PROCESSING_SRC_PATH/processing/data/*.java \ + $PROCESSING_SRC_PATH/processing/event/*.java \ + $PROCESSING_SRC_PATH/processing/opengl/*.java \ + $PROCESSING_LIB_PATH/io/src/processing/io/*.java \ + $PROCESSING_LIB_PATH/net/src/processing/net/*.java \ + $PROCESSING_LIB_PATH/serial/src/processing/serial/*.java" + else + echo "Generating $1 library" + echo "[REFERENCE GENERATOR] Removing previous version of the ref..." + rm -rf $REFERENCES_OUT_PATH/$1 + mkdir $REFERENCES_OUT_PATH/$1 + FOLDERS="$PROCESSING_LIB_PATH/../../../processing-$1/src/processing/$1/*.java" +fi echo "[REFERENCE GENERATOR] Generating new javadocs..." javadoc -doclet ProcessingWeblet \ @@ -33,13 +72,5 @@ javadoc -doclet ProcessingWeblet \ -includedir ../../content/api_en/include \ -imagedir images \ -encoding UTF-8 \ - $PROCESSING_SRC_PATH/processing/core/*.java \ - $PROCESSING_SRC_PATH/processing/data/*.java \ - $PROCESSING_SRC_PATH/processing/event/*.java \ - $PROCESSING_SRC_PATH/processing/opengl/*.java \ - $PROCESSING_LIB_PATH/io/src/processing/io/*.java \ - $PROCESSING_LIB_PATH/net/src/processing/net/*.java \ - $PROCESSING_LIB_PATH/serial/src/processing/serial/*.java \ - $PROCESSING_LIB_PATH/../../../processing-video/src/processing/video/*.java \ - $PROCESSING_LIB_PATH/../../../processing-sound/src/processing/sound/*.java \ + $FOLDERS \ -noisy \ No newline at end of file From 55b9e1043e49f9ceec57c41de9dd13fda837ed92 Mon Sep 17 00:00:00 2001 From: Rune Madsen Date: Thu, 28 Jan 2021 16:19:48 +0100 Subject: [PATCH 2/5] updated doclet script instructions --- doclet/README.md | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/doclet/README.md b/doclet/README.md index 64237704c..92c6a6eee 100644 --- a/doclet/README.md +++ b/doclet/README.md @@ -1,31 +1,33 @@ # Doclet -This is a custom Doclet that generates JSON files based on Javadoc comments in java files. These JSON files have all the information necessary for building the reference pages on [processing.org](https://processing.org). The Doclet will generate JSON reference files for all libraries that come with Processing as well as the external sound and video libraries. +This is a custom Doclet that generates JSON files based on Javadoc comments in `.java` files. These JSON files have all the information necessary for building the reference pages on [processing.org](https://processing.org). -## How to use - -The Doclet will run through the `.java` files in the `processing` repo and output `.json` files in the `processing-website` repo inside the `content/references/translations/en/` folder. In order for that to work, you must first have the following four repositories in the same root folder: +The Doclet will run through the `.java` file in the following repositories: - [`processing/processing4`](https://github.com/processing/processing4) (this repo) -- [`processing/processing-website`](https://github.com/processing/processing-website) (this currently lives in the designsystemsinternational GitHub account) - [`processing/processing-sound`](https://github.com/processing/processing-sound) - [`processing/processing-video`](https://github.com/processing/processing-video) -In order to run the Doclet, you need to have Java JDK 11 installed and set the `JAVA_HOME` environment variable to point to it. The name of the JDK file may vary depending on your exact version. +It will read the JavaDoc comments, create a series of `.json` files, and save them into the Processing website repository in the `content/references/translations/en/` folder: -``` -export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.8.jdk/Contents/Home/ -``` +- [`processing/processing-website`](https://github.com/processing/processing-website) -You also need to have [Apache Ant](https://ant.apache.org/manual/install.html) installed in version 1.8 or above. +## How to use -Now run the Doclet: +First, make sure that you have the proper setup before running the script: -1. First move into the `processing4/doclet/ReferenceGenerator` folder +- Clone down whichever repository listed above that you need to have updated on the website. You will need at least one of `processing/processing4`, `processing/processing-sound` or `processing/processing-video` alongside the `processing/processing-website` repo. The repositories need to be alongside each other in the same folder. +- Make sure you have Java JDK 11 installed and the `JAVA_HOME` environment variable set to point to the installation. The name of the JDK file may vary depending on your exact version (e.g. `export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.8.jdk/Contents/Home/`). +- Make sure you have [Apache Ant](https://ant.apache.org/manual/install.html) installed in version 1.8 or above. + +Now you are ready to run the doclet + +1. First `cd` into the `processing4/doclet/ReferenceGenerator` folder 2. Run `ant compile` -3. Run `./processingrefBuild.sh` **note:if you want to run the script just for the main processing references(including libraries serial, net and io) you should run `./processingrefBuild.sh processing` and if you want to run the script for sound or video library you should run `./processingrefBuild.sh sound` or `./processingrefBuild.sh video`** +3. Run the script: -If you are only updating the processing reference and not the sound or video libraries, you can comment out the part related to those libraries in the `processingrefBuild.sh` file. Please remember to not commit these changes to the repo. +- If you are updating a single repository, run `./processingrefBuild.sh processing`, `./processingrefBuild.sh sound` or `./processingrefBuild.sh video` +- If you are updating all the repositories, run `./processingrefBuild.sh` If you just want to test the Doclet without the `processing-website` repo, you can create the following folder structure in the root folder and see the files: From a6283eabe159842af9946a71599d1ca961cd73cf Mon Sep 17 00:00:00 2001 From: Rune Madsen Date: Thu, 28 Jan 2021 16:21:28 +0100 Subject: [PATCH 3/5] updated doclet script instructions --- doclet/README.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/doclet/README.md b/doclet/README.md index 92c6a6eee..df75a69a6 100644 --- a/doclet/README.md +++ b/doclet/README.md @@ -24,10 +24,7 @@ Now you are ready to run the doclet 1. First `cd` into the `processing4/doclet/ReferenceGenerator` folder 2. Run `ant compile` -3. Run the script: - -- If you are updating a single repository, run `./processingrefBuild.sh processing`, `./processingrefBuild.sh sound` or `./processingrefBuild.sh video` -- If you are updating all the repositories, run `./processingrefBuild.sh` +3. Run `./processingrefBuild.sh` if you are updating all the repositories or `./processingrefBuild.sh processing`, `./processingrefBuild.sh sound` or `./processingrefBuild.sh video` if you are updating a single repository. If you just want to test the Doclet without the `processing-website` repo, you can create the following folder structure in the root folder and see the files: From 392712380ddc3718d60620e7dcb48487a5cc3c43 Mon Sep 17 00:00:00 2001 From: Anadroid Date: Tue, 15 Jun 2021 11:58:06 +0200 Subject: [PATCH 4/5] Adjusting doclet so it doesn't delete exhisting files --- .../ReferenceGenerator/processingrefBuild.sh | 21 ++----------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/doclet/ReferenceGenerator/processingrefBuild.sh b/doclet/ReferenceGenerator/processingrefBuild.sh index f773dceab..6c4f163b0 100755 --- a/doclet/ReferenceGenerator/processingrefBuild.sh +++ b/doclet/ReferenceGenerator/processingrefBuild.sh @@ -11,20 +11,13 @@ REFERENCES_OUT_PATH=../../../processing-website/content/references/translations/ echo "[REFERENCE GENERATOR] Source Path :: $PROCESSING_SRC_PATH" echo "[REFERENCE GENERATOR] Library Path :: $PROCESSING_LIB_PATH" -# You can pass one argument "sound" or "video" to generate those libraries separately +# You can pass one argument "sound" or "video" (without the "") to generate those libraries separately +# or "processing" to generate the core without the sound and video libraries # if there is no argument it will generate everything if [ $# -eq 0 ] then echo "No arguments supplied, generating everything" echo "[REFERENCE GENERATOR] Removing previous version of the ref..." - rm -rf $REFERENCES_OUT_PATH - mkdir $REFERENCES_OUT_PATH - mkdir $REFERENCES_OUT_PATH/processing - mkdir $REFERENCES_OUT_PATH/io - mkdir $REFERENCES_OUT_PATH/net - mkdir $REFERENCES_OUT_PATH/serial - mkdir $REFERENCES_OUT_PATH/sound - mkdir $REFERENCES_OUT_PATH/video FOLDERS="$PROCESSING_SRC_PATH/processing/core/*.java \ $PROCESSING_SRC_PATH/processing/data/*.java \ $PROCESSING_SRC_PATH/processing/event/*.java \ @@ -38,14 +31,6 @@ if [ $# -eq 0 ] then echo "Generating processing references" echo "[REFERENCE GENERATOR] Removing previous version of the ref..." - rm -rf $REFERENCES_OUT_PATH/processing - rm -rf $REFERENCES_OUT_PATH/io - rm -rf $REFERENCES_OUT_PATH/net - rm -rf $REFERENCES_OUT_PATH/serial - mkdir $REFERENCES_OUT_PATH/processing - mkdir $REFERENCES_OUT_PATH/io - mkdir $REFERENCES_OUT_PATH/net - mkdir $REFERENCES_OUT_PATH/serial FOLDERS="$PROCESSING_SRC_PATH/processing/core/*.java \ $PROCESSING_SRC_PATH/processing/data/*.java \ $PROCESSING_SRC_PATH/processing/event/*.java \ @@ -56,8 +41,6 @@ if [ $# -eq 0 ] else echo "Generating $1 library" echo "[REFERENCE GENERATOR] Removing previous version of the ref..." - rm -rf $REFERENCES_OUT_PATH/$1 - mkdir $REFERENCES_OUT_PATH/$1 FOLDERS="$PROCESSING_LIB_PATH/../../../processing-$1/src/processing/$1/*.java" fi From 7c2e472720cf6468ca0b24c1564903cf6745c4a1 Mon Sep 17 00:00:00 2001 From: Anadroid Date: Tue, 15 Jun 2021 12:19:45 +0200 Subject: [PATCH 5/5] Changing doclets for exceptions to the PGraphics class and fixing comments --- core/src/processing/core/PApplet.java | 8 ++++---- doclet/ReferenceGenerator/processingrefBuild.sh | 2 +- doclet/ReferenceGenerator/src/writers/ClassWriter.java | 6 ++++-- doclet/ReferenceGenerator/src/writers/MethodWriter.java | 4 ++++ 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index f019fb66d..37174cceb 100644 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -259,13 +259,13 @@ public class PApplet implements PConstants { /** * - * When pixelDensity(2) is used to make use of a high resolution + * When pixelDensity(2) is used to make use of a high resolution * display (called a Retina display on OS X or high-dpi on Windows and * Linux), the width and height of the sketch do not change, but the * number of pixels is doubled. As a result, all operations that use pixels * (like loadPixels(), get(), set(), etc.) happen * in this doubled space. As a convenience, the variables pixelWidth - * and pixelHeight hold the actual width and height of the sketch + * and pixelHeight hold the actual width and height of the sketch * in pixels. This is useful for any sketch that uses the pixels[] * array, for instance, because the number of elements in the array will * be pixelWidth*pixelHeight, not width*height. @@ -282,13 +282,13 @@ public class PApplet implements PConstants { /** * - * When pixelDensity(2) is used to make use of a high resolution + * When pixelDensity(2) is used to make use of a high resolution * display (called a Retina display on OS X or high-dpi on Windows and * Linux), the width and height of the sketch do not change, but the * number of pixels is doubled. As a result, all operations that use pixels * (like loadPixels(), get(), set(), etc.) happen * in this doubled space. As a convenience, the variables pixelWidth - * and pixelHeight hold the actual width and height of the sketch + * and pixelHeight hold the actual width and height of the sketch * in pixels. This is useful for any sketch that uses the pixels[] * array, for instance, because the number of elements in the array will * be pixelWidth*pixelHeight, not width*height. diff --git a/doclet/ReferenceGenerator/processingrefBuild.sh b/doclet/ReferenceGenerator/processingrefBuild.sh index 6c4f163b0..561f2ba41 100755 --- a/doclet/ReferenceGenerator/processingrefBuild.sh +++ b/doclet/ReferenceGenerator/processingrefBuild.sh @@ -11,7 +11,7 @@ REFERENCES_OUT_PATH=../../../processing-website/content/references/translations/ echo "[REFERENCE GENERATOR] Source Path :: $PROCESSING_SRC_PATH" echo "[REFERENCE GENERATOR] Library Path :: $PROCESSING_LIB_PATH" -# You can pass one argument "sound" or "video" (without the "") to generate those libraries separately +# You can pass one argument "sound" or "video" to generate those libraries separately # or "processing" to generate the core without the sound and video libraries # if there is no argument it will generate everything if [ $# -eq 0 ] diff --git a/doclet/ReferenceGenerator/src/writers/ClassWriter.java b/doclet/ReferenceGenerator/src/writers/ClassWriter.java index b8d6787cc..eb5bfd702 100644 --- a/doclet/ReferenceGenerator/src/writers/ClassWriter.java +++ b/doclet/ReferenceGenerator/src/writers/ClassWriter.java @@ -77,8 +77,10 @@ public class ClassWriter extends BaseWriter { for (MethodDoc m : classDoc.methods()) { if(needsWriting(m)){ - MethodWriter.write((HashMap)vars.clone(), m, classname, folderName); - methodSet.add(getPropertyInfo(m)); + if (!classname.equals("PGraphics") || getName(m).equals("beginDraw()") || getName(m).equals("endDraw()")) { + MethodWriter.write((HashMap)vars.clone(), m, classname, folderName); + methodSet.add(getPropertyInfo(m)); + } } } diff --git a/doclet/ReferenceGenerator/src/writers/MethodWriter.java b/doclet/ReferenceGenerator/src/writers/MethodWriter.java index 52ae362d8..97d120377 100644 --- a/doclet/ReferenceGenerator/src/writers/MethodWriter.java +++ b/doclet/ReferenceGenerator/src/writers/MethodWriter.java @@ -35,6 +35,8 @@ public class MethodWriter extends BaseWriter { String category = getCategory(tags[0]); String subcategory = getSubcategory(tags[0]); + if (!classname.equals("PGraphics") || getName(doc).equals("beginDraw()") || getName(doc).equals("endDraw()")) { + try { methodJSON.put("type", "method"); @@ -72,6 +74,8 @@ public class MethodWriter extends BaseWriter { } catch (IOException e) { e.printStackTrace(); } + + } } }