From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id BxhyJ1xCcV8kKAAA0tVLHw (envelope-from ) for ; Mon, 28 Sep 2020 01:54:36 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id mCmZIlxCcV/qFAAAB5/wlQ (envelope-from ) for ; Mon, 28 Sep 2020 01:54:36 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B33709402B2 for ; Mon, 28 Sep 2020 01:54:35 +0000 (UTC) Received: from localhost ([::1]:49086 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kMiN7-0007B1-8O for larch@yhetil.org; Sun, 27 Sep 2020 21:54:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40280) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kMiMW-0007Ak-GQ for emacs-orgmode@gnu.org; Sun, 27 Sep 2020 21:53:56 -0400 Received: from mail-ed1-f53.google.com ([209.85.208.53]:36299) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kMiMR-0007BA-9R for emacs-orgmode@gnu.org; Sun, 27 Sep 2020 21:53:56 -0400 Received: by mail-ed1-f53.google.com with SMTP id w1so8397618edr.3 for ; Sun, 27 Sep 2020 18:53:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6VTHi7By4yvDTLVcYUi650bn6gwZQIA/2NpeA4GTfMY=; b=UdxPx9gtUCoyaXkO/lJQQBHtizJuA9wP+kmpZthYih0Blwclj4x6a8tlYW/wdwONtA NVxPO3/+f8ucVx9rnt89zQfEYP8nlh3nHEOH9hCZ/wTsTQy8q0sh7VpT83gMbJvuG5yO t0VjFzi2VzS2/AzdL3Z90wuFvfl99H4AylzCWL5KLeXmqOVeK20LlVfgzShaxX6TtqMB Lxr652UfFxXK/2dZ/1e2vx1CTVaxY72/oGqHuy0OsB3LWU1d46jP6I4UM2ZA8mc5UkdM if6eTPWCdJGOf23LHJCO6IBXMntVzxVhw57PztyTKeirQsqSiiUdY7E1mj07rPVVFJoe Abkg== X-Gm-Message-State: AOAM530WhwmWIAZmxELR7tucq3EZBMdCeASN+UZvoLC7wYpIUU0pByS5 xTo+vZqU51vwV55J16jqz5NTrgQSvWQpGmB4g7g= X-Google-Smtp-Source: ABdhPJwDS6oOMC6L1I4zC/RqFWHTGD6rTEBTHNdxAkngmA8jSFDjJufjSfdfBYHUP4gPIILMyJ9fIljfyZ+6YY+G+tY= X-Received: by 2002:a05:6402:1c1b:: with SMTP id ck27mr13016369edb.12.1601258029047; Sun, 27 Sep 2020 18:53:49 -0700 (PDT) MIME-Version: 1.0 References: <87imbyapel.fsf@gmail.com> In-Reply-To: <87imbyapel.fsf@gmail.com> From: ian martins Date: Sun, 27 Sep 2020 21:53:38 -0400 Message-ID: Subject: Re: ob-java compile only To: John Herrlin Content-Type: multipart/alternative; boundary="00000000000003e55a05b055f059" Received-SPF: pass client-ip=209.85.208.53; envelope-from=ianxm1@gmail.com; helo=mail-ed1-f53.google.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/27 21:53:49 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.078, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.462, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Org-Mode mailing list Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=jhu.edu (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: 0.09 X-TUID: wKYMlYgnMDzN --00000000000003e55a05b055f059 Content-Type: text/plain; charset="UTF-8" Hi John, Thanks for the suggestion and patch. Is the reason for this so that you can have classes without needing dummy "main" methods? Did you consider using org-babel-tangle to generate the source files? This works for me: Steps: 1. put javatangle.org (below) on your local. 2. create "pkg" directory where javatangle.org is 3. run org-babel-tangle on javatangle.org (this writes two source files to the pkg dir) 4. run C-c C-c on the top source block (this compiles both source files and runs main) ----- javatangle.org ----- #+begin_src java :results output :classname pkg/Main :tangle pkg/Main.java package pkg; public class Main { public static void main(String[] args) { System.out.println(Hey.hey()); } } #+end_src #+begin_src java :results output :classname pkg/Hey :tangle pkg/Hey.java package pkg; public class Hey { public static String hey() { return "hey"; } } #+end_src On Sun, Sep 27, 2020 at 5:19 PM John Herrlin wrote: > > Hey Ian! > > Happy to see you as the maintainer of the ob-java! > > I would like to propose a feature to ob-java. The feature allows a > source code block to write and compile only, without executing. > > Here is a common use case for me. > > Class without a entry point have an :compile-only header. > > #+HEADER: :classname se/my_test_package/Hey > #+HEADER: :dir src > #+HEADER: :compile-only t > #+HEADER: :results none > #+BEGIN_SRC java > package se.my_test_package; > > public class Hey { > public static String hey(String name) { > return "Hey " + name; > } > } > #+END_SRC > > The provided diff works for my small use case. What do you think? > > -- > Best regards > John > > --00000000000003e55a05b055f059 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi John,

Thanks for the sugg= estion and patch. Is the reason for this so that you can have classes witho= ut needing dummy "main" methods?

Did you= consider using org-babel-tangle to generate the source files? This works f= or me:

Steps:
1. put javatangle.org (below) on your local.
2. c= reate "pkg" directory where jav= atangle.org is
3. run org-babel-tangle on javatangle.org (this writes two source files to the = pkg dir)
4. run C-c C-c on the top source block (this compile= s both source files and runs main)

----- javatangle.org -----

#+begin_src java :results output :classname pkg/Main :tangle pkg/M= ain.java
=C2=A0 package pkg;

=C2=A0 public class Main {
=C2=A0= =C2=A0 =C2=A0 public static void main(String[] args) {
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 System.out.println(Hey.hey());
=C2=A0 =C2=A0 =C2=A0= }
=C2=A0 }
#+end_src

#+begin_src java :results output :classn= ame pkg/Hey :tangle pkg/Hey.java
=C2=A0 package pkg;

=C2=A0 publi= c class Hey {
=C2=A0 =C2=A0 =C2=A0 public static String hey() {
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return "hey";
=C2=A0 =C2=A0 = =C2=A0 }
=C2=A0 }
#+end_src



On Sun, Sep 27, 2020 at 5:19 PM John Herrlin <jherrlin@gmail.com> wrote:

Hey Ian!

Happy to see you as the maintainer of the ob-java!

I would like to propose a feature to ob-java. The feature allows a
source code block to write and compile only, without executing.

Here is a common use case for me.

Class without a entry point have an :compile-only header.

=C2=A0 =C2=A0#+HEADER: :classname se/my_test_package/Hey
=C2=A0 =C2=A0#+HEADER: :dir src
=C2=A0 =C2=A0#+HEADER: :compile-only t
=C2=A0 =C2=A0#+HEADER: :results none
=C2=A0 =C2=A0#+BEGIN_SRC java
=C2=A0 =C2=A0 =C2=A0package se.my_test_package;

=C2=A0 =C2=A0 =C2=A0public class Hey {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0public static String hey(String name) { =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return "Hey " + n= ame;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
=C2=A0 =C2=A0 =C2=A0}
=C2=A0 =C2=A0#+END_SRC

The provided diff works for my small use case. What do you think?

--
Best regards
John

--00000000000003e55a05b055f059--